// -----------------------------------------------------------------------
//  <copyright file="CommandLineBuilder.cs" company="LiuliuSoft">
//      Copyright (c) 2022-2022 DaprPlus. All rights reserved.
//  </copyright>
//  <site>https://www.dapr.plus</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2022-11-26 23:55</last-date>
// -----------------------------------------------------------------------

namespace DaprPlus.Development;

public class CommandLineArgs
{
    public CommandLineArgs(string prefix)
    {
        Prefix = prefix;
        Args = new List<string>();
    }

    public string Prefix { get; }

    public List<string> Args { get; }

    public CommandLineArgs Add(string name, string value, bool isSkip = false)
    {
        if (!isSkip)
        {
            Args.Add($"{Prefix}{name} {value}");
        }

        return this;
    }

    public override string ToString() => Args.Count == 0 ? "" : string.Join(' ', Args);
}
